# This part of the code will displace the spectrum according to the radial velocity
# for galactic or near sources, or according to the redshift if the source's
# velocity is dominated by the cosmlogical Hubble's flux.
# Written by Sergio Scarano Jr (scarano@astro.iag.usp.br) jul 2009.

import numpy
import scipy

execfile(os.path.join(_path,"calibspec.py"))

# Calculating the radial velocity or the redshfit

lightspeed = 2.9979E5

if velrad == '':
   velrad = lightspeed*((redshift+1)**2-1)/((redshift+1)**2+1)
if redshift == '':
   redshift = numpy.sqrt((1+velrad/lightspeed)/(1-velrad/lightspeed)) - 1

shiftwave=wave*(1+redshift)
lambdashift=lambda0*(1+redshift)

#pylab.plot(wave,calibflux)
#pylab.plot(shiftwave,calibflux)
#pylab.show()
